{literal}
  <script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete this group. Continue?"))
document.location = "admin.php?page=group&action=delete&id=" + articleId;
}

function show(id)
{
	var item = null;
	if (document.getElementById)
	{
		item = document.getElementById(id);
	}
	else if (document.all)
	{
		item = document.all[id];
	}
	else if (document.layers)
	{
		item = document.layers[id];
	}

	if (item && item.style)
	{
        if (item.style.display == "none")
		{
			item.style.display = "";
		}
	}
	else if (item)
	{
		item.visibility = "show";
	}
}

function hide(id)
{
	var item = null;
	if (document.getElementById)
	{
		item = document.getElementById(id);
	}
	else if (document.all)
	{
		item = document.all[id];
	}
	else if (document.layers)
	{
		item = document.layers[id];
	}

	if (item && item.style)
	{
       item.style.display = "none";
	}
	else if (item)
	{
		item.visibility = "hide";
	}
}

//-->
  </script>
  {/literal}

{if ($action != "edit") && ($action!="Add")}
{if $numgroups > 0}
<h2>Groups/Patrols</h2>
<div align="left"><input type="button" class="button" value="Add New Group" onclick="window.location='{$pagename}&amp;action=Add'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
<tr> 
  <th colspan="4" class="bighead">Groups/Patrols
  </th>
</tr>
<tr> 
  <th width="10%" class="smallhead">Action</th>
  <th width="70%" class="smallhead">Group Name</th>
  <th width="10%" class="smallhead">Public Group</th>
  <th width="10%" class="smallhead">User Registrable</th>
</tr>
{section name=groups loop=$numgroups}
<tr>
  <td class="text">{if $groups[groups].teamname != "Admin" && $groups[groups].teamname != "New User"}<a href="{$pagename}&amp;action=edit&amp;id={$groups[groups].id}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$groups[groups].teamname}" title="Edit {$groups[groups].teamname}" /></a> - <a href="javascript:confirmDelete({$groups[groups].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$groups[groups].teamname}" title="Delete {$groups[groups].teamname}" /></a>{/if}</td>
  <td class="text">{$groups[groups].teamname}</td>
  <td class="text">{if ($groups[groups].ispublic  == 1)}Yes{if $groups[groups].subsite != '0'}({$groups[groups].subsite}){/if}{else}No{/if}</td>
  <td class="text">{if ($groups[groups].register  == 1)}Yes{else}No{/if}</td>
</tr>
{/section}
</table>
{else}
<div align="center">No groups</div>
{/if}
<div align="left"><input type="button" class="button" value="Add New Group" onclick="window.location='{$pagename}&amp;action=Add'" /></div>
{elseif ($action=="edit" || $action=="Add")}
<form name="form1" method="post" action="{$editFormAction}">
Group Name: 
    <input name="name" type="text" id="name" size="60" maxlength="50" value="{$group.teamname}" class="inputbox" />
    <div>
    Make group Public (This means that the group get a website)?
    <input type="radio" name="publicgroup" value="1" {if $group.ispublic == 1}checked{/if} onclick="show('public');"/>Yes
    <input type="radio" name="publicgroup" value="0" {if $group.ispublic == 0}checked{/if}  onclick="hide('public');"/>No
    </div>
    <div id="public" style="display: {if $group.ispublic != 1}none;{else}'';{/if}">
        Can this group get points (Will only work if this group is marked as public)?
        <input type="radio" name="points" value="1" {if $group.getpoints == 1}checked{/if} />Yes
        <input type="radio" name="points" value="0" {if $group.getpoints == 0}checked{/if} />No<br />
        Patrol?
        <input type="radio" name="patrol" value="1" {if $group.ispatrol == 1}checked{/if} onclick="show('public');"/>Yes
        <input type="radio" name="patrol" value="0" {if $group.ispatrol == 0}checked{/if}  onclick="hide('public');"/>No<br />
        Which subsite does this group fall under?
    <select name="subsite" id="subsite" class="inputbox" >
      <option value="0" {if $group.subsite== '0'}selected{/if}>None</option>
      {section name=subsite loop=$numsites}
        <option value="{$subsite[subsite].name}" {if $group.subsite == $subsite[subsite].name}selected{/if}>{$subsite[subsite].name}</option> 
     {/section}     
    </select>
    </div>
        <div>

    Can users register as part of this group?
    <input type="radio" name="register" value="1" {if $group.register == 1}checked{/if} />Yes
    <input type="radio" name="register" value="0" {if $group.register == 0}checked{/if} />No
    </div>
    <input type="submit" name="Submit" value="Submit" class="button" />
    <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
    <br />
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-groups" target="_blank">Help</a>
</div>
